package com.xj.edu.hotel.service.serviceImpl;

import com.xj.edu.hotel.domain.Manager;
import com.xj.edu.hotel.mapper.ManagerMapper;
import com.xj.edu.hotel.service.ManagerService;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ManagerServiceImpl implements ManagerService {

    @Autowired
    private ManagerMapper managerMapper;

//    @Override
//    public Manager findByName(Manager manager) {
//        return managerMapper.selectByName(manager.getManagerName());
//    }

    @Override
    public int insert(Manager manager) {
      return managerMapper.insert(manager);
    }

    @Override
    public  List<Manager> findByName(String name) {
        return managerMapper.selectByName(name);
    }

    @Override
    public List<Manager> findAll() {
        return managerMapper.selectAll();
    }

    @Override
    public int delManager(String id) {
        return managerMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Manager findById(String id) {
        return managerMapper.selectById(id);
    }
    @Override
    public int updateRole(Manager manager) {
        return managerMapper.updateByPrimaryKeySelective(manager);
    }
}
